﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

namespace NetDiskPRJ.Common
{
    public class MD5
    {
        /// <summary>
        /// MD5加密
        /// </summary>
        /// <param name="stringValue"></param>
        /// <returns></returns>
        public static string MD5Encrypt(string stringValue)
        {
            string outString = "";
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
            byte[] inBytes = Encoding.GetEncoding("GB2312").GetBytes(stringValue);
            byte[] outBytes = md5.ComputeHash(inBytes);

            for (int i = 0; i < outBytes.Length; i++)
            {
                outString += outBytes[i].ToString("x2");
            }
            return outString;
        }
    }
}
